﻿<phone:PhoneApplicationPage
    x:Class="Minion.Win.Client.Views.LocationItemList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Style="{StaticResource GenBg}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="161" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="Minion" Style="{StaticResource PhoneTextNormalStyle}" Foreground="Black" />
            <Grid x:Name="Title" Background="Transparent" Height="113">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" MinHeight="50" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row ="0" Grid.Column="0" Text="Nearby" Margin="9,-7,0,494" Style="{StaticResource PhoneTextTitle1Style}" HorizontalAlignment="Left" Foreground="Black" />
                <Button x:Name="AddItem" Grid.Row="0" Content="Add" Margin="312,22,20,513" RenderTransformOrigin="0.51,1.042" FontSize="16" Click="AddItem_Click" Background="#FFE4C817" FontWeight="Bold" Foreground="#FF1B1111"/>
            </Grid>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" Background="#FFF1E998">

            <phone:LongListSelector x:Name="LocationItemSelector" ItemsSource="{Binding}" HorizontalAlignment="Left"
                                    Height="500" Margin="10,42,0,0" VerticalAlignment="Top" Width="436"
                                    SelectionChanged="LongListSelector_SelectionChanged" BorderBrush="#FF0E0D0D">
                <phone:LongListSelector.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="0,6,0,0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Rectangle Fill="#FFF1E998" Height="50" Width="50" Grid.Row="0" Grid.Column="0"
                                       VerticalAlignment="Center" Margin="0,7,7,0"
                                       Grid.RowSpan="2">

                            </Rectangle>
                            <Image Height="50" Width="50" Grid.Row="0" Grid.Column="0" 
                         VerticalAlignment="Top" Margin="0,7,7,0"
                       Grid.RowSpan="2">
                                <Image.Source>
                                    <BitmapImage UriSource="{Binding ImageUrl}"
                                     CreateOptions="BackgroundCreation"/>
                                </Image.Source>
                            </Image>
                            <TextBlock Text="{Binding ItemTitle}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Top" Foreground="{StaticResource PhoneBackgroundBrush}" />

                            <TextBlock Text="{Binding ItemDescription}" TextWrapping="Wrap"
                                       Grid.Row="1" Grid.Column="1"
                                       VerticalAlignment="Top" Foreground="{StaticResource PhoneTextBoxReadOnlyBrush}" />

                        </Grid>
                    </DataTemplate>
                </phone:LongListSelector.ItemTemplate>
            </phone:LongListSelector>

        </Grid>
    </Grid>

</phone:PhoneApplicationPage>